<template>
  <div class="content">
    <p>用户列表</p>
    <el-row>
      <el-col :span="6">
        <el-table
          :data="data">
          <el-table-column 
            prop="username"
            label="姓名"
          />
          <el-table-column 
            prop="roleName"
            label="角色"
          />
        </el-table>
      </el-col>
    </el-row>
  </div>  
</template>

<script>
export default {
  data () {
    return {
      data: []
    }
  },
  methods: {
    init () {
      this.$http.get('/user')
        .then(res => {
          this.data = res.data.slice(0)
        })
    },
  },
  created () {
    this.init()
  }
}
</script>

